package com.wuhongyu.controller;

import com.wuhongyu.entity.Storage;
import com.wuhongyu.service.StorageService;
import com.wuhongyu.util.MyUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * 仓库
 */
@Controller
@RequestMapping("/storage")
public class StorageController {

    @Autowired
    private StorageService storageService;

    @RequestMapping("/list")
    public String list(Model model, HttpServletRequest request, Storage storage, Integer number) {
        model.addAttribute("url", MyUtil.getUrl(request));
        model.addAttribute("page", storageService.findAll(storage, number));
        return "~basd/storage";
    }

}